package cn.lanqiao.bigDate.service.sys.impl;

import cn.lanqiao.bigDate.entity.sys.SysArea;
import cn.lanqiao.bigDate.mapper.sys.SysAreaMapper;
import cn.lanqiao.bigDate.service.sys.PluginsService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Mairsa
 * @date 2022/3/23
 */
@Service
public class PluginsServiceImpl implements PluginsService {

    @Resource
    private SysAreaMapper sysAreaMapper;

    @Override
    public List<SysArea> findSysAreaByLevel(Long level) {
        QueryWrapper<SysArea> wrapper = new QueryWrapper<>();
        wrapper.eq("level",level);
        List<SysArea> areaList = sysAreaMapper.selectList(wrapper);
        areaList.forEach(System.out::println);
        return areaList;
    }

    @Override
    public List<SysArea> findSysAreaByLevel(Long level,Long parentId) {
        QueryWrapper<SysArea> wrapper = new QueryWrapper<>();
        wrapper.eq("level",level);
        wrapper.eq("parent_code",parentId);
        List<SysArea> areaList = sysAreaMapper.selectList(wrapper);
        areaList.forEach(System.out::println);
        return areaList;
    }
}
